package com.dlyk.service.impl;

import com.dlyk.manager.TranManager;
import com.dlyk.mapper.TTranHistoryMapper;
import com.dlyk.model.TTranHistory;
import com.dlyk.query.TranHistoryQuery;
import com.dlyk.service.TranHistoryService;
import com.dlyk.util.JWTUtils;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @description:
 * @author: ajie
 * @date: 2024/8/13 22:14:18
 * @version: 1.0
 */
@Service
public class TranHistoryServiceImpl implements TranHistoryService {

    @Resource
    private TTranHistoryMapper tTranHistoryMapper;

    @Resource
    private TranManager tranManager;

    /**
     * 更新交易历史（阶段）
     *
     * @param tranHistoryQuery
     * @return
     */
    @Override
    public int saveTranHistory(TranHistoryQuery tranHistoryQuery) {

        return tranManager.saveTranHistoryAndUpdateTran(tranHistoryQuery);
    }

    /**
     * 查询交易历史/阶段记录
     *
     * @param tranId
     * @return
     */
    @Override
    public List<TTranHistory> getTranHistoryByTranId(Integer tranId) {
        return tTranHistoryMapper.selectByTranId(tranId);
    }
}
